Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

381
Views
¿Cómo ocultar botones según tu "trabajo"?

Estoy creando una aplicación y quiero que los botones aparezcan en función de su $job . Hay 4 trabajos, que están todos en bases de datos mysql:

  1. alumno
  2. profesor
  3. personal
  4. principal,

El botón de registro solo puede ser visto por el maestro, el personal y el director.

Pero no sé cómo hacerlo.

Aquí está mi código:

 <?php session_start(); include("connection.php"); include("functions.php"); $user_data = check_login($con); if ($_SERVER['REQUEST_METHOD'] == "POST") { $job = $_POST['job']; } ?> <!DOCTYPE html> <html> <head> <title> NetPlat </title> </head> <body> <a href="login.php"> <button id="button">Logout</button> </a><br><br> <a href="signup.php"> <button>Signup Student</button> </a> </body> </html>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Rodear el marcado del botón con una declaración if simple usando la función in_array para verificar que el trabajo está permitido, funcionará.

 <?php if(in_array($job, ['teacher', 'staff', 'principal'])) { ?> <a href="signup.php"> <button>Signup Student</button> </a> <?php } ?>

Lo anterior solo generará el botón html si el valor de $job se encuentra en la matriz.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!